/*
 * Copyright (C) 2009  Nepala Esperanto-Asocio, http://www.esperanto.org.np/
 * Author: Jacob Nordfalk
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 */
/*
 * ConversionToolsFrame.java
 *
 * Created on December 3, 2008, 11:41 AM
 */

package np.esperanto.conv4.ui;

import java.util.prefs.Preferences;
import javax.swing.UIManager;

/**
 *
 * @author  j
 */
public class ConversionToolsFrame extends javax.swing.JFrame {

    Preferences prefs = Preferences.userNodeForPackage(this.getClass()).node(this.getClass().getSimpleName());

    /** Creates new form ConversionToolsFrame */
    public ConversionToolsFrame() {
        initComponents();
        
        //jTabbedPane1.setSelectedIndex( prefs.getInt("tab",0));
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    jTabbedPane1 = new javax.swing.JTabbedPane();
    jPanel1 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    jPanel2 = new javax.swing.JPanel();
    jButton1 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jButton3 = new javax.swing.JButton();
    jButton4 = new javax.swing.JButton();
    jLabel3 = new javax.swing.JLabel();
    conversionPanelF2U1 = new np.esperanto.conv4.ui.ConversionPanelF2U();
    conversionPanelTrans1 = new np.esperanto.conv4.ui.ConversionPanelTrans();
    conversionPanelDevelopment1 = new np.esperanto.conv4.ui.ConversionPanelDevelopment();
    jMenuBar1 = new javax.swing.JMenuBar();
    jMenu1 = new javax.swing.JMenu();
    jMenuItem1 = new javax.swing.JMenuItem();
    jMenu2 = new javax.swing.JMenu();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() | java.awt.Font.BOLD, jLabel1.getFont().getSize()+6));
    jLabel1.setText("नेपाल एस्पेरान्तो संघको Conversions Tools");

    jLabel2.setText("Please select what you want to do:");

    jPanel2.setLayout(new java.awt.GridLayout(2, 2, 20, 20));

    jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/np/org/mpp/conv4/ui/f2u.png"))); // NOI18N
    jButton1.setText("<html><body>Convert from non-Unicode font to <b>Unicode</b>");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        jButton1ActionPerformed(evt);
      }
    });
    jPanel2.add(jButton1);

    jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/np/org/mpp/conv4/ui/u2f.png"))); // NOI18N
    jButton2.setText("<html><body>Convert from Unicode to non-Unicode <b>Font</b> (like Preeti)");
    jButton2.setEnabled(false);
    jPanel2.add(jButton2);

    jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/np/org/mpp/conv4/ui/trans.png"))); // NOI18N
    jButton3.setText("<html><body>Convert from Devanagari to <br><b>Roman</b> transliteration");
    jButton3.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        jButton3ActionPerformed(evt);
      }
    });
    jPanel2.add(jButton3);

    jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/np/org/mpp/conv4/ui/exit.png"))); // NOI18N
    jButton4.setText("<html><body><b>Exit</b> from the Application");
    jButton4.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        exitActionPerformed(evt);
      }
    });
    jPanel2.add(jButton4);

    jLabel3.setText("<html><body>\nAŭtoro: Jacob Nordfalk,  Nepala Esperanto-Asocio<br>\nDankon al/Thanks to: Heidel Press, Dilibazaar, Kathmandu:<br>\n- tipar-konvertaj tabeloj / font conversion tables<br>\n- presi / pressing नेपाली-एस्पेरान्तो शब्दकोश - Nepali-Esperanto-vortaro<br>\n<br>\n<font size=\"+2\">अन्तराष्त्रिय भाषल एस्पेरान्तो सिकौ  ...  संसार भरी साथी बनाऔ </font><br>\nhttp://www.esperanto.org.np/\n");

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
      jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(jPanel1Layout.createSequentialGroup()
        .addContainerGap()
        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 887, javax.swing.GroupLayout.PREFERRED_SIZE)
          .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 799, javax.swing.GroupLayout.PREFERRED_SIZE)
          .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 799, javax.swing.GroupLayout.PREFERRED_SIZE)
          .addComponent(jLabel2))
        .addContainerGap(340, Short.MAX_VALUE))
    );
    jPanel1Layout.setVerticalGroup(
      jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(jPanel1Layout.createSequentialGroup()
        .addContainerGap()
        .addComponent(jLabel1)
        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
        .addComponent(jLabel3)
        .addGap(26, 26, 26)
        .addComponent(jLabel2)
        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addContainerGap(72, Short.MAX_VALUE))
    );

    jLabel3.getAccessibleContext().setAccessibleName("<html><body>Author: Jacob Nordfalk, Nepala Esperanto-Asocio<br>\n<font size=\"+3\">अन्तराष्त्रिय भाषल एस्पेरान्तो सिकौ <br> संसार भरी साथी बनाऔ </font><br><br>\nThanks to: Heidel Press, Dilibazaar, Kathmandu for<br>\n- press of नेपाली-एस्पेरान्तो शब्दकोश Nepali-Esperanto-vortaro<br>\n- font conversion tables for this tool<br>");

    jTabbedPane1.addTab("Welcome", jPanel1);
    jTabbedPane1.addTab("Font to Unicode", new javax.swing.ImageIcon(getClass().getResource("/np/org/mpp/conv4/ui/f2u.png")), conversionPanelF2U1); // NOI18N
    jTabbedPane1.addTab("Transliterator", new javax.swing.ImageIcon(getClass().getResource("/np/org/mpp/conv4/ui/trans.png")), conversionPanelTrans1); // NOI18N
    jTabbedPane1.addTab("Development", conversionPanelDevelopment1);

    jMenu1.setText("File");

    jMenuItem1.setMnemonic('X');
    jMenuItem1.setText("Exit");
    jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        exitActionPerformed(evt);
      }
    });
    jMenu1.add(jMenuItem1);

    jMenuBar1.add(jMenu1);

    jMenu2.setText("Options");
    jMenuBar1.add(jMenu2);

    setJMenuBar(jMenuBar1);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1243, Short.MAX_VALUE)
    );
    layout.setVerticalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 578, Short.MAX_VALUE)
    );

    pack();
  }// </editor-fold>//GEN-END:initComponents

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
  jTabbedPane1.setSelectedComponent(conversionPanelF2U1);
  prefs.putInt("tab", jTabbedPane1.getSelectedIndex());
}//GEN-LAST:event_jButton1ActionPerformed

private void exitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitActionPerformed
// TODO add your handling code here:
  System.exit(0);
}//GEN-LAST:event_exitActionPerformed

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
  jTabbedPane1.setSelectedComponent(conversionPanelTrans1);  
  prefs.putInt("tab", jTabbedPane1.getSelectedIndex());  
}//GEN-LAST:event_jButton3ActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
			try {
			    UIManager.setLookAndFeel(UIManager
				    .getSystemLookAndFeelClassName());
			} catch (Exception exception) {
			    exception.printStackTrace();
			}
                new ConversionToolsFrame().setVisible(true);
            }
        });
    }
    
    
    
  // Variables declaration - do not modify//GEN-BEGIN:variables
  private np.esperanto.conv4.ui.ConversionPanelDevelopment conversionPanelDevelopment1;
  private np.esperanto.conv4.ui.ConversionPanelF2U conversionPanelF2U1;
  private np.esperanto.conv4.ui.ConversionPanelTrans conversionPanelTrans1;
  private javax.swing.JButton jButton1;
  private javax.swing.JButton jButton2;
  private javax.swing.JButton jButton3;
  private javax.swing.JButton jButton4;
  private javax.swing.JLabel jLabel1;
  private javax.swing.JLabel jLabel2;
  private javax.swing.JLabel jLabel3;
  private javax.swing.JMenu jMenu1;
  private javax.swing.JMenu jMenu2;
  private javax.swing.JMenuBar jMenuBar1;
  private javax.swing.JMenuItem jMenuItem1;
  private javax.swing.JPanel jPanel1;
  private javax.swing.JPanel jPanel2;
  private javax.swing.JTabbedPane jTabbedPane1;
  // End of variables declaration//GEN-END:variables

}
